package com.d0310;

public abstract class Lock {
    public abstract void open();

    public void close()//抽象方法，只有方法名，没有方法体
    {

    }

}

class FingerprintLock extends Lock{

    @Override
    public void open() {
        System.out.println("指纹锁的open方法");
    }
}
//实现一个派生类FaceLock
class FaceLock extends Lock{

    @Override
    public void open() {
        System.out.println("面部识别");
    }
}
class TestLock{
    public static void main(String[] args) {
        //Lock lock = new Lock();//抽象类不能实例化
        FingerprintLock fingerprintLock = new FingerprintLock();
        fingerprintLock.open();
        FaceLock faceLock = new FaceLock();
        faceLock.open();
    }
}
